home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Extra 1996 #3
/
AmigaPlus_CD-ROM-EXTRA_Nr.3.bin
/
aminet-spiele
/
zwei spieler
/
lordofhosts
/
lohsrc.lzh
/
display.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-05-10
|
15KB
|
461 lines
/* LORD OF HOSTS - display.c --- Grafikroutinen */
#include "Lord.h"
extern struct RastPort *RP;
extern struct ViewPort *VP;
extern struct BitMap *BM,PiecesBM;
/* IMAGES - erstellt mit NGI 1.3 */
UWORD RKingData[168] = {
/* BitPlane 0 */
0x7FFF,0xF000, 0x0000,0x0800, 0x01F8,0x0800, 0x03FC,0x0800, 0x03FC,0x0800,
0x03FC,0x0800, 0x03FC,0x0800, 0x03FC,0x0800, 0x01F8,0x0800, 0x00F8,0x0800,
0x0000,0x0800, 0x2040,0x4800, 0x2040,0x8800, 0x2081,0x0800, 0x2082,0x0800,
0x1104,0x0800, 0x1000,0x0800, 0x0800,0x0800, 0x0FFF,0x8800, 0x0000,0x0800,
0x0000,0x0000,
/* BitPlane 1 */
0xFFFF,0xF800, 0x7F07,0xF800, 0x7FFB,0xF800, 0x7FFD,0xF800, 0x7FFD,0xF800,
0x7FFD,0xF800, 0x7FFD,0xF800, 0x7FFD,0xF800, 0x7FFB,0xF800, 0x7FFF,0xF800,
0x7FFF,0xF800, 0x5F9F,0xB800, 0x4F9F,0x3800, 0x470E,0x3800, 0x430C,0x3800,
0x6000,0x7800, 0x6000,0x7800, 0x7000,0x7800, 0x7000,0x7800, 0x7FFF,0xF800,
0x8000,0x0800,
/* BitPlane 2 */
0x0000,0x0000, 0x80F8,0x0000, 0x80FC,0x0000, 0x81FE,0x0000, 0x81FE,0x0000,
0x81FE,0x0000, 0x81FE,0x0000, 0x81FE,0x0000, 0x80FC,0x0000, 0x8000,0x0000,
0xA000,0x2000, 0xB040,0x6000, 0xA850,0xA000, 0xA489,0x2000, 0xA28A,0x2000,
0x9104,0x4000, 0x9000,0x4000, 0x8800,0x0000, 0x8FFF,0x8000, 0x8000,0x0000,
0x7FFF,0xF000,
/* BitPlane 3 */
0x0000,0x0000, 0x0000,0x0000, 0x00F8,0x0000, 0x01FC,0x0000, 0x01FC,0x0000,
0x01FC,0x0000, 0x01FC,0x0000, 0x01FC,0x0000, 0x00F8,0x0000, 0x0000,0x0000,
0x0000,0x0000, 0x0020,0x0000, 0x1020,0x4000, 0x1870,0xC000, 0x1C71,0xC000,
0x0EFB,0x8000, 0x0FFF,0x8000, 0x07FF,0x8000, 0x0000,0x0000, 0x0000,0x0000,
0x0000,0x0000
};
UWORD WKingData[168] = {
/* BitPlane 0 */
0x8000,0x0800, 0xFFFF,0xF000, 0xF000,0x7000, 0xF000,0x3000, 0xF000,0x3000,
0xF000,0x3000, 0xE186,0x1000, 0xE387,0x1000, 0xE7CF,0x9000, 0xEFCF,0xD000,
0xFFFF,0xF000, 0xFFFF,0xF000, 0xFEFF,0xF000, 0xFDFF,0xF000, 0xFDFF,0xF000,
0xFDFF,0xF000, 0xFDFF,0xF000, 0xFDFF,0xF000, 0xFEFF,0xF000, 0xFF07,0xF000,
0xFFFF,0xF800,
/* BitPlane 1 */
0x7FFF,0xF000, 0x8000,0x0800, 0x8FFF,0x8800, 0x9000,0x4800, 0x9000,0x4800,
0x9104,0x4800, 0xA28A,0x2800, 0xA489,0x2800, 0xA850,0xA800, 0xB010,0x6800,
0xA000,0x2800, 0x80F8,0x0800, 0x81FC,0x0800, 0x83FE,0x0800, 0x83FE,0x0800,
0x83FE,0x0800, 0x83FE,0x0800, 0x83FE,0x0800, 0x81FC,0x0800, 0x80F8,0x0800,
0x7FFF,0xF000,
/* BitPlane 2 */
0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xF000,0x7800, 0xF000,0x7800,
0xF104,0x7800, 0xE38E,0x3800, 0xE78F,0x3800, 0xEFDF,0xB800, 0xFF9F,0xF800,
0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800,
0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800,
0xFFFF,0xF800,
/* BitPlane 3 */
0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0FFF,0x8000, 0x0FFF,0x8000,
0x0EFB,0x8000, 0x1C71,0xC000, 0x1870,0xC000, 0x1020,0x4000, 0x0020,0x0000,
0x0000,0x0000, 0x0000,0x0000, 0x00F8,0x0000, 0x01FC,0x0000, 0x01FC,0x0000,
0x01FC,0x0000, 0x01FC,0x0000, 0x01FC,0x0000, 0x00F8,0x0000, 0x0000,0x0000,
0x0000,0x0000
};
UWORD RKnightData[168] = {
/* BitPlane 0 */
0x7FFF,0xF000, 0x0000,0x0800, 0x01F8,0x0800, 0x03FC,0x0800, 0x03FC,0x0800,
0x03FC,0x0800, 0x03FC,0x0800, 0x03FC,0x0800, 0x01F8,0x0800, 0x00F8,0x0800,
0x0000,0x0800, 0x0000,0x0800, 0x0010,0x0800, 0x0008,0x0800, 0x0004,0x0800,
0x0002,0x0800, 0x0001,0x0800, 0x0000,0x8800, 0x0000,0x4800, 0x0000,0x0800,
0x0000,0x0000,
/* BitPlane 1 */
0xFFFF,0xF800, 0x7F07,0xF800, 0x7FFB,0xF800, 0x7FFD,0xF800, 0x7FFD,0xF800,
0x7FFD,0xF800, 0x7FFD,0xF800, 0x7FFD,0xF800, 0x7FFB,0xF800, 0x7FFF,0xF800,
0x7FFF,0xF800, 0x7FDF,0xF800, 0x7FBF,0xF800, 0x7F7F,0xF800, 0x7EFF,0xF800,
0x7DFF,0xF800, 0x7BFF,0xF800, 0x77FF,0xF800, 0x6000,0x7800, 0x7FFF,0xF800,
0x8000,0x0800,
/* BitPlane 2 */
0x0000,0x0000, 0x80F8,0x0000, 0x80FC,0x0000, 0x81FE,0x0000, 0x81FE,0x0000,
0x81FE,0x0000, 0x81FE,0x0000, 0x81FE,0x0000, 0x80FC,0x0000, 0x8000,0x0000,
0x8000,0x0000, 0x8020,0x0000, 0x8040,0x0000, 0x8080,0x0000, 0x8100,0x0000,
0x8200,0x0000, 0x8400,0x0000, 0x8800,0x0000, 0x9FFF,0x8000, 0x8000,0x0000,
0x7FFF,0xF000,
/* BitPlane 3 */
0x0000,0x0000, 0x0000,0x0000, 0x00F8,0x0000, 0x01FC,0x0000, 0x01FC,0x0000,
0x01FC,0x0000, 0x01FC,0x0000, 0x01FC,0x0000, 0x00F8,0x0000, 0x0000,0x0000,
0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000,
0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000,
0x0000,0x0000
};
UWORD WKnightData[168] = {
/* BitPlane 0 */
0x8000,0x0800, 0xFFFF,0xF000, 0xF000,0x3000, 0xFFFF,0x7000, 0xFFFE,0xF000,
0xFFFD,0xF000, 0xFFFB,0xF000, 0xFFF7,0xF000, 0xFFEF,0xF000, 0xFFDF,0xF000,
0xFFFF,0xF000, 0xFFFF,0xF000, 0xFEFF,0xF000, 0xFDFF,0xF000, 0xFDFF,0xF000,
0xFDFF,0xF000, 0xFDFF,0xF000, 0xFDFF,0xF000, 0xFEFF,0xF000, 0xFF07,0xF000,
0xFFFF,0xF800,
/* BitPlane 1 */
0x7FFF,0xF000, 0x8000,0x0800, 0x9FFF,0xC800, 0x8800,0x8800, 0x8401,0x0800,
0x8202,0x0800, 0x8104,0x0800, 0x8088,0x0800, 0x8050,0x0800, 0x8020,0x0800,
0x8000,0x0800, 0x80F8,0x0800, 0x81FC,0x0800, 0x83FE,0x0800, 0x83FE,0x0800,
0x83FE,0x0800, 0x83FE,0x0800, 0x83FE,0x0800, 0x81FC,0x0800, 0x80F8,0x0800,
0x7FFF,0xF000,
/* BitPlane 2 */
0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800,
0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800,
0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800,
0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800, 0xFFFF,0xF800,
0xFFFF,0xF800,
/* BitPlane 3 */
0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000,
0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000, 0x0000,0x0000,
0x0000,0x0000, 0x0000,0x0000, 0x00F8,0x0000, 0x01FC,0x0000, 0x01FC,0x0000,
0x01FC,0x0000, 0x01FC,0x0000, 0x01FC,0x0000, 0x00F8,0x0000, 0x0000,0x0000,
0x0000,0x0000
};
UWORD BlendFrageData[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0x8800, 0x6000, 0xC800, 0xF800, 0xC800,
/* BitPlane 3 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800
};
UWORD Blend1Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0xD800, 0x9800, 0xD800, 0xD800, 0x8800,
/* BitPlane 3 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800
};
UWORD Blend2Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0x8800, 0x6000, 0xC800, 0x9800, 0x0000,
/* BitPlane 3 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800
};
UWORD Blend3Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0x8800, 0x6000, 0xC800, 0x6000, 0x8800,
/* BitPlane 3 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800
};
UWORD Blend4Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0xE800, 0xC800, 0xA800, 0x0000, 0xE800,
/* BitPlane 3 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800
};
UWORD SetFrageData[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 3 */
0x8800, 0x6000, 0xC800, 0xF800, 0xC800
};
UWORD Set1Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 3 */
0xD800, 0x9800, 0xD800, 0xD800, 0x8800
};
UWORD Set2Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 3 */
0x8800, 0x6000, 0xC800, 0x9800, 0x0000
};
UWORD Set3Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 3 */
0x8800, 0x6000, 0xC800, 0x6000, 0x8800
};
UWORD Set4Data[20] = {
/* BitPlane 0 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 1 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 2 */
0xF800, 0xF800, 0xF800, 0xF800, 0xF800,
/* BitPlane 3 */
0xE800, 0xC800, 0xA800, 0x0000, 0xE800
};
struct Image Blend[5] =
{
{ 0, 0, 5, 5, 4, &BlendFrageData[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Blend1Data[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Blend2Data[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Blend3Data[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Blend4Data[0], 0x0F, 0x00, NULL }
};
struct Image Set[5] =
{
{ 0, 0, 5, 5, 4, &SetFrageData[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Set1Data[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Set2Data[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Set3Data[0], 0x0F, 0x00, NULL },
{ 0, 0, 5, 5, 4, &Set4Data[0], 0x0F, 0x00, NULL }
};
struct Image Pieces[4] =
{
{ 0, 0, 21, 21, 4, &RKingData[0], 0x0F, 0x00, NULL },
{ 0, 0, 21, 21, 4, &WKingData[0], 0x0F, 0x00, NULL },
{ 0, 0, 21, 21, 4, &RKnightData[0], 0x0F, 0x00, NULL },
{ 0, 0, 21, 21, 4, &WKnightData[0], 0x0F, 0x00, NULL }
};
/* Ende der Images-Definitionen */
void DrawRect(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
ULONG toy)
{
SetAPen(RP,Color);
SetDrMd(RP,DrMd);
Move(RP,fromx,fromy);
Draw(RP,tox,fromy);
Draw(RP,tox,toy);
Draw(RP,fromx,toy);
Draw(RP,fromx,fromy);
}
void DrawLine(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
ULONG toy)
{
SetAPen(RP,Color);
SetDrMd(RP,DrMd);
Move(RP,fromx,fromy);
Draw(RP,tox,toy);
}
void FillRect(ULONG Color, ULONG fromx, ULONG fromy, ULONG tox, ULONG toy)
{
SetAPen(RP,Color);
SetDrMd(RP,JAM1);
RectFill(RP,fromx,fromy,tox,toy);
}
void DrawText(ULONG Color, ULONG DrMd, ULONG x, ULONG y, char *string)
{
int len;
SetAPen(RP,Color);
SetDrMd(RP,DrMd);
len = strlen(string);
Move(RP, x, y+7);
Text(RP, string, len);
}
void drawboard(void)
{
int i,j,col=0;
DrawRect(6, JAM1, 0, 11, 187, 198);
DrawRect(5, JAM1, 1, 12, 186, 197);
for (i=2;i<=164;i+=23)
{
DrawLine(14,JAM1,i,13,i,196);
DrawLine(12,JAM1,i+22,13,i+22,196);
}
for (i=13;i<=174;i+=23)
{
DrawLine(14,JAM1,2,i,185,i);
DrawLine(12,JAM1,2,i+22,185,i+22);
}
for (i=3;i<=164;i+=23)
{
col=2-col; /* Umschalten zwischen den Schachbrettfarben */
for (j=14;j<=175;j+=23)
{
col=2-col;
FillRect(13+col,i,j,i+20,j+20);
}
}
}
void drawplayers(char *Name1, char *Name2)
{
int i,rng[5]={1,0,2,0,1},len;
for (i=0;i<=4;++i)
{
DrawRect(2+rng[i],JAM1,190+i,11+i,319-i,40-i);
DrawRect(5+rng[i],JAM1,190+i,44+i,319-i,72-i);
}
FillRect(13,195,16,314,35);
FillRect(13,195,49,314,67);
DrawText(1,JAM1,223,16,"Player 1");
DrawText(1,JAM1,223,49,"Player 2");
len = strlen(Name1) * 8; /* Pixelbreite von Name1 */
len /= 2;
DrawText(2,JAM1,255-len,25,Name1);
len = strlen(Name2) * 8; /* Pixelbreite von Name2 */
len /= 2;
DrawText(5,JAM1,255-len,58,Name2);
}
void SetPiece(struct Piece Which, BOOL FadeIn, BOOL StayBlend)
{ /* die beiden BOOLs: Farben hochfahren, Am Ende Farbe 1 setzen ? */
int xpos,ypos,i;
BOOL white=FALSE;
xpos = 3 + 23*Which.x;
ypos = 14+ 23*Which.y;
DrawImage(RP,&Pieces[Which.ID],xpos,ypos);
if (Which.ID % 2) white = TRUE;
SetRGB4(VP,11,0,0,0);
DrawImage(RP,&Blend[Which.Value],xpos+8,ypos+(white ? 13 : 3));
if (FadeIn)
{
for (i=1;i<=15;++i)
{
SetRGB4(VP,11,i,i,i);
WaitTOF();
}
}
SetRGB4(VP,11,15,15,15);
if (!StayBlend) DrawImage(RP,&Set[Which.Value],xpos+8,ypos+(white ? 13 : 3));
}
/* vor MovePiece muß SetPiece mit StayBlend == TRUE gesetzt werden, sonst wird
der Zahlenwert des Steins nicht ausgeblendet. Außerdem darf nur entweder
xdist ODER ydist != 0 sein !!! (Sonst wird nur xdist beachtet)
Nach MovePiece muß SetPiece mit StayBlend == FALSE und FadeIn == TRUE
aufgerufen werden */
void MovePiece(UBYTE x, UBYTE y, int xdist, int ydist, BOOL FadeOut)
{
int xpos,ypos,i,j,fieldcol,sign,brightness=15;
xpos = 3 + 23*x;
ypos = 14+ 23*y;
BltBitMap(BM,xpos,ypos,&PiecesBM,0,0,21,21,0x00c0,0x00ff,NULL);
if (xdist)
{
sign = (xdist>0) ? 1 : -1;
for (i=0; (xdist>0)? i<xdist: i>xdist; (xdist>0)? ++i: --i)
{
if ((x + y) % 2) fieldcol = 15; else fieldcol = 13;
for (j=0; j!=21*sign; j+=sign)
{
xpos+=sign;
BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
if (sign>0)
DrawLine(fieldcol,JAM1,xpos-1,ypos,xpos-1,ypos+20);
else
DrawLine(fieldcol,JAM1,xpos+21,ypos,xpos+21,ypos+20);
if (brightness > 0 && FadeOut == TRUE)
{
SetRGB4(VP,11,brightness,brightness,brightness);
--brightness;
}
WaitTOF();
}
xpos+=sign;
BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
if (sign>0)
DrawLine(12,JAM1,xpos-1,ypos,xpos-1,ypos+20);
else
DrawLine(14,JAM1,xpos+21,ypos,xpos+21,ypos+20);
WaitTOF();
xpos+=sign;
BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
if (sign>0)
DrawLine(14,JAM1,xpos-1,ypos,xpos-1,ypos+20);
else
DrawLine(12,JAM1,xpos+21,ypos,xpos+21,ypos+20);
WaitTOF();
x += sign;
}
}
else /* ydist != 0 */
{
sign = (ydist>0) ? 1 : -1;
for (i=0; (ydist>0)? i<ydist: i>ydist; (ydist>0)? ++i: --i)
{
if ((x + y) % 2) fieldcol = 15; else fieldcol = 13;
for (j=0; j!=21*sign; j+=sign)
{
ypos+=sign;
BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
if (sign>0)
DrawLine(fieldcol,JAM1,xpos,ypos-1,xpos+20,ypos-1);
else
DrawLine(fieldcol,JAM1,xpos,ypos+21,xpos+20,ypos+21);
if (brightness > 0 && FadeOut == TRUE)
{
SetRGB4(VP,11,brightness,brightness,brightness);
--brightness;
}
WaitTOF();
}
ypos+=sign;
BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
if (sign>0)
DrawLine(12,JAM1,xpos,ypos-1,xpos+20,ypos-1);
else
DrawLine(14,JAM1,xpos,ypos+21,xpos+20,ypos+21);
WaitTOF();
ypos+=sign;
BltBitMap(&PiecesBM,0,0,BM,xpos,ypos,21,21,0x00c0,0x00ff,NULL);
if (sign>0)
DrawLine(14,JAM1,xpos,ypos-1,xpos+20,ypos-1);
else
DrawLine(12,JAM1,xpos,ypos+21,xpos+20,ypos+21);
WaitTOF();
y += sign;
}
}
}
void Highlight(UBYTE x, UBYTE y)
{
int xpos,ypos;
xpos = 1 + 23*x;
ypos = 12+ 23*y;
DrawRect(1,COMPLEMENT,xpos,ypos,xpos+24,ypos+24);
DrawRect(1,COMPLEMENT,xpos+1,ypos+1,xpos+23,ypos+23);
}